﻿using Bids.Core.Infrastructure;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Telerik.OpenAccess;
using Telerik.OpenAccess.Metadata;
using Telerik.OpenAccess.Metadata.Fluent;

namespace Bids.Core.DomainObjects
{
    [Serializable]
    public class Admin:IEntity
    {
        /// <summary>
        /// 
        /// </summary>
        public virtual int ID { set; get; }
        /// <summary>
        /// 管理员用户名
        /// </summary>
        public virtual string UserName { set; get; }
        /// <summary>
        /// 密码
        /// </summary>
        public virtual string Password { set; get; }
        /// <summary>
        /// 添加时间
        /// </summary>
        public virtual DateTime CreateTime { set; get; }

        public static MappingConfiguration<Admin> CreateConfiguration()
        {
            var threadMapping = new MappingConfiguration<Admin>();
            threadMapping.MapType(t => new { 
                t.ID,
                t.UserName,
                t.Password,
            t.CreateTime}).ToTable("Admins");
            threadMapping.HasProperty(t => t.ID).IsIdentity(KeyGenerator.Autoinc);
            return threadMapping;
        }

    }
}
